package com.ruoyi.system.domain.Bo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.ruoyi.system.utils.validate.AddGroup;
import com.ruoyi.system.utils.validate.EditGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;

/**
 * 用户模块业务对象 users
 *
 * @author ruoyi
 * @date 2022-08-17
 */

@Data
public class UsersBo{

    /**
     * 用户id
     */
    @Null(message = "用户id必须为空", groups = {  AddGroup.class, EditGroup.class })
    private Integer userId;

    /**
     * 用户昵称
     */
    @NotBlank(message = "用户昵称不能为空", groups = { AddGroup.class, EditGroup.class })
    private String userName;

    /**
     * 用户密码
     */
    @NotBlank(message = "用户密码不能为空", groups = { AddGroup.class, EditGroup.class })
    @Length(min = 6,max = 18,message = "密码必须是6-18位")
    private String userPass;

    /**
     * 确认密码，表中不存在该字段
     */
    // @NotBlank(message = "用户确认密码不能为空",groups = { AddGroup.class, EditGroup.class})
    @TableField(exist = false)
    private String confirmPass;

    /**
     * 用户手机，用作用户账户使用
     */
    @NotBlank(message = "用户手机不能为空", groups = { AddGroup.class/*, EditGroup.class */})
    @Pattern(regexp = "^[1]([3-9])[0-9]{9}$",message = "手机号格式不正确")
    private String userPhone;

    /**
     * 用户邮箱
     */
    // @NotBlank(message = "用户邮箱不能为空", groups = { AddGroup.class, EditGroup.class })
    private String userEmail;

    /**
     * 用户钱包（元）
     */
    @Null(message = "用户钱包（元）必须为空", groups = { AddGroup.class, EditGroup.class })
    private Long wallet;

    /**
     * 用户头像
     */
    // @NotBlank(message = "用户头像不能为空", groups = { AddGroup.class, EditGroup.class })
    private String userImg;

    /**
     * 盐
     */
    @Null(message = "填写非法字段", groups = { AddGroup.class, EditGroup.class })
    private String salt;

}
